<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>秒表</title>
    <script src="js/common.js"></script>
</head>
<body>
<p id="display">0</p>
<button id="start" onclick="start()">开始</button>
<button id="stop" onclick="stop()" disabled>暂停</button>
<button id="reset" onclick="reset()" disabled>清零</button>
<button id="mark" onclick="mark()">记录</button>
<p></p>
<script>
    let num = 0; //用于计时
    let intervalTime;
    function start(){
         intervalTime = setInterval(myTime, 1000);
        $("start").disabled=true;
        $("stop").disabled=false;
        $("reset").disabled=true;
    }

    function stop(){
        clearInterval(intervalTime);
        $("start").innerText = "继续";
        $("start").disabled=false;
        $("stop").disabled=true;
        $("reset").disabled=false;
    }
    function reset(){
        num=0;
        $("start").innerText = "开始";
        $("display").innerText=num;
        $("start").disabled=false;
        $("stop").disabled=true;

    }
    function myTime(){
        num=num+1;
        $("display").innerText=num;
    }
    function mark(){
        let p = document.createElement("p");
        p.innerText=num;
    }
</script>
</body>
</html>